class CardHightLightFilter extends egret.GlowFilter{
	private static _ins:CardHightLightFilter
	public static get instance(){
		if(!CardHightLightFilter._ins){
			CardHightLightFilter._ins = new CardHightLightFilter()
		}
		return CardHightLightFilter._ins
	}
	private _tw:egret.Tween
	private _highlightTgt:egret.DisplayObject[]
	public constructor() {
		super(0xEEEEEE, 0.7, 30, 30, 30, 1, true)
		this._tw = egret.Tween.get(this, {loop:true})
		.to({
			strength: 5,
		}, 1000)
		.to({
			strength: 20,
		}, 1000)
		// this._tw.pause()
		this._highlightTgt = []
	}

	public addHighLight(obj:egret.DisplayObject){
		obj.filters = [this]
		this._highlightTgt.push(obj)
		if(this._highlightTgt.length == 1) this._tw.setPaused(false)
	}

	public removeHightLight(obj:egret.DisplayObject){
		const arr = this._highlightTgt
		for(let i=0; i<arr.length; i++){
			if(arr[i] == obj){
				const obj2 = arr.splice(i,1)[0]
				obj2.filters = []
				break
			}
		}
		if(arr.length == 0) this._tw.setPaused(true)
	}
}